<template>
    <div>
        <ul class="mui-table-view">
				<li class="mui-table-view-cell mui-media" v-for="item in newslist" :key="item.id">
					<router-link :to="'/home/newsinfo/' + item.id">
						<img class="mui-media-object mui-pull-left" :src="item.img_url">
						<div class="mui-media-body">
							<h1>{{item.title}}</h1>
							<p class='mui-ellipsis'>
                                <span>{{item.add_time}}</span>
                                <span>{{item.click}}</span>
                            </p>
						</div>
					</router-link>
				</li>
			</ul>
    </div>
</template>

<script>
import Toast from 'mint-ui'
export default {
    data(){
        return {
            newslist: [
            //     {id:1,title:"新闻1",addtime:"2019",clicknum:"点击:'1次'",img:"http://img5.imgtn.bdimg.com/it/u=2230167403,4188800858&fm=26&gp=0.jpg"},
            //     {id:2,title:"新闻2",addtime:"2018",clicknum:"点击:'2次'",img:"http://img1.imgtn.bdimg.com/it/u=2735633715,2749454924&fm=26&gp=0.jpg"},
            //     {id:3,title:"新闻3",addtime:"2017",clicknum:"点击:'3次'",img:"http://img5.imgtn.bdimg.com/it/u=935292084,2640874667&fm=26&gp=0.jpg"},
            //     {id:4,title:"新闻4",addtime:"2016",clicknum:"点击:'5次'",img:"http://image.baidu.com/search/detail?ct=503316480&z=undefined&tn=baiduimagedetail&ipn=d&word=%E5%9B%BE%E7%89%87&step_word=&ie=utf-8&in=&cl=2&lm=-1&st=undefined&hd=undefined&latest=undefined&copyright=undefined&cs=4118960086,2125569760&os=1534863547,1704417784&simid=4222745290,742120008&pn=3&rn=1&di=7654157830&ln=1667&fr=&fmq=1550726586700_R&fm=&ic=undefined&s=undefined&se=&sme=&tab=0&width=undefined&height=undefined&face=undefined&is=0,0&istype=0&ist=&jit=&bdtype=0&spn=0&pi=0&gsm=0&objurl=http%3A%2F%2Fwww.pptbz.com%2Fpptpic%2FUploadFiles_6909%2F201306%2F2013062320262198.jpg&rpstart=0&rpnum=0&adpicid=0&force=undefined"},
            //     {id:5,title:"新闻5",addtime:"2015",clicknum:"点击:'0次'",img:"http://img1.imgtn.bdimg.com/it/u=2687927787,2181890558&fm=26&gp=0.jpg"},
            ],
        }
    },
    created(){
        this.getNewsList()
    },
    methods:{
        getNewsList(){
            this.$http.get('http://www.liulongbin.top:3005/api/getnewslist').then(result =>{
                if(result.body.status ===0){
                    this.newslist = result.body.message;
                }else{
                    Toast('获取数据失败');
                }
            })
        },
    },
}
</script>

<style lang="scss" scoped>
    
    .mui-table-view{
        li {
            h1{font-size: 14px;}
            p{
                display: flex;
                justify-content: space-between;
            }
        }
    }

</style>